-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: add support for SSE MCP servers #5517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for SSE MCP servers #5517
Conversation
✅ Deploy Preview for continuedev canceled.
|
Thanks @04cfb1ed I closed my PR to avoid confusion as it was just a quick draft I didn't spend much time on, and yours is more complete. |
Hi @04cfb1ed, Following @nejch's suggestion on the now-closed PR #5511, I wanted to reach out here. Thank you for picking this up and creating a more complete implementation for SSE/WebSocket MCP server support! This is a feature I was really looking forward to for my own setup. Since the original PR was a draft and I was eager to test this out, I quickly put together a working version (for my specific SSE use case) in my fork: It mainly involved completing the URL handling in Please feel free to reference it if any part might be helpful for finalizing this PR (#5517). No pressure at all, just wanted to share my work in case it's useful. Thanks again for implementing this much-needed feature, and looking forward to seeing this merged! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks solid, thanks for adding the tests as well! Just had a few small comments.
Is there an SSE server you could point me towards to test this locally?
@04cfb1ed waiting for your powers for this megical feature :) |
…t) in the YAML configuration schema, ensuring backward compatibility with legacy configurations
669fb03
to
0356b0d
Compare
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
The minimal python SSE server to test is this:
from mcp.server.fastmcp import FastMCP
from mcp.server.fastmcp.prompts import base
from starlette.applications import Starlette
from starlette.routing import Host, Mount
mcp = FastMCP("My App")
# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
@mcp.prompt()
def review_code(code: str) -> str:
"""Review code prompt"""
return f"Please review this code:\n\n{code}"
@mcp.prompt()
def debug_error(error: str) -> list[base.Message]:
"""Debug error prompt"""
return [
base.UserMessage("I'm seeing this error:"),
base.UserMessage(error),
base.AssistantMessage("I'll help debug that. What have you tried so far?"),
]
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
"""Get a personalized greeting"""
return f"Hello, {name}!"
# Mount the SSE server to the existing ASGI server
app = Starlette(
routes=[
Mount("/", app=mcp.sse_app()),
]
)
if __name__ == "__main__":
import uvicorn
uvicorn.run(
"minimal:app", host="127.0.0.1", port=8000, log_level="debug", reload=True
) mcpServers:
- name: Debug Local Minimal MCP Python
type: sse
url: http://127.0.0.1:8000/sse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cc @sestinj for a final pass. I believe any type errors with the logic in https://github.com/continuedev/continue/pull/5517/files#diff-08ccd8e386037c8ed8e2008a5de3a2a675bfaaca98adbd8609bb241d578980bcR83 should be caught in CI, and the new param is optional, so shouldn't cause any issues.
You folks saved my day!! Looking forward to testing this together with https://github.com/automation-ai-labs/mcp-link 🤩 |
Great, I can't wait for it to be merged and available to use! |
@Patrick-Erichsen After this PR is completed, is it supported to update the information returned by the tool in real-time in the UI? The scenario I'm currently facing is: I have an MCP tool that always running for a long time, so I need to let the user see the running status in the UI. If it is SSE protocol communication, I believe it should be able to stream back the current running progress information of the tool, such as running step 1... running step 2... status, displayed in real-time in the UI, so that users can know the execution status of the tool If my SSE MCP tools use a streaming API to continuously return chuck data, I hope it can be updated in the UI |
Thanks for the great PR @04cfb1ed ! @AfterStories - that definitely sounds possible. Is it supported by MCP protocol currently? If you don't mind, please open a new issue and let's move the conversation there to keep this PR discussion focused. |
Hey @04cfb1ed , apologies for missing this in my original review but there appears to be an issue with configs that don't specify the transport type, so I had to rollback this PR. The following config.yaml is failing: mcpServers:
- name: Memory
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-memory" with this error: There also appears to be a typecheck error here: https://github.com/continuedev/continue/blob/main/core/config/yaml/loadYaml.ts#L454-L466 I don't think I/the team will have the bandwidth this week to look into it, but @04cfb1ed if you or anyone else can pick it up it would still be awesome to get SSE support merged 👍 |
Description
Add support for multiple MCP server types (stdio, sse, websocket) in the YAML configuration schema, ensuring backward compatibility with legacy configurations).
I just saw the #5511 I was working on this PR a few days ago, I leave here, but I don't know how to proceed
Closes #5359
Checklist
Screenshots
[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]
Testing instructions
[ For new or modified features, provide step-by-step testing instructions to validate the intended behavior of the change, including any relevant tests to run. ]